//
//  DetailView.swift
//  RssFly
//
//  Created by shen on 2023/10/17.
//

import SwiftUI

struct DetailView: View {
    @ObservedObject var profile: Profile

    @Binding var detailPanel: DetailPanel?
    @Binding var hideRead: Bool
    @Binding var refreshing: Bool
    @Binding var path: NavigationPath
    
    @SceneStorage("ShowingInspector") private var showingInspector = false

    var body: some View {
        NavigationStack(path: $path) {
            Group {
                switch detailPanel ?? .welcome {
//                case .inbox:
//                    Inbox(profile: profile, hideRead: $hideRead)
//                case .organizer:
//                    Organizer(profile: profile, showingInspector: $showingInspector)
//                case let .page(page):
//                    PageView(
//                        page: page,
//                        profile: profile,
//                        hideRead: $hideRead,
//                        showingInspector: $showingInspector
//                    )
//                case let .search(query):
//                    SearchView(profile: profile, hideRead: $hideRead, query: query)
//                case let .tag(tag):
//                    TagView(profile: profile, tag: tag)
//                case .trending:
//                    Trending(profile: profile, hideRead: $hideRead)
                case .welcome:
                    Welcome(profile: profile)
                default:
                    Text("Hello - TODO")
                }
            }
            .disabled(refreshing)
//            .navigationDestination(for: SubDetailPanel.self) { panel in
//                Group {
//                    switch panel {
//                    case let .bookmark(bookmark):
//                        BookmarkView(bookmark: bookmark)
//                    case let .feed(feed):
//                        FeedView(feed: feed, hideRead: $hideRead, showingInspector: $showingInspector)
//                    case let .item(item):
//                        ItemView(item: item, profile: profile)
//                    case let .trend(trend):
//                        TrendView(trend: trend, hideRead: $hideRead)
//                    }
//                }
//                .disabled(refreshing)
//            }
        }
    }
}
